<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html>
<head>
<title>小区统计</title>
<jsp:include page="../../views/layout/inc.jsp"></jsp:include>
<script type="text/javascript">
	var dataGrid;
	$(function() {
		dataGrid = $('#dataGrid').datagrid({
			singleSelect : true,
			url : '/villageStatisticsController/dataGrid',
			fit : true,
			fitColumns : true,
			border : false,
			pagination : true,
			idField : 'id',
			pageSize : 10,
			pageList : [ 10, 20, 30, 40, 50 ],
			sortName : 'gmtCreate',
			sortOrder : 'asc',
			checkOnSelect : false,
			selectOnCheck : false,
			nowrap : false,
			frozenColumns : [ [ {
				field : 'id',
				title : '编号',
				hidden :true,
				width : 150,
				checkbox : true
			}, {
				field : 'name',
				title : '小区名字',
				width : 80,
				sortable : true
			}, {
				field : 'code',
				title : '小区代码',
				width : 80,
				sortable : true
			} ] ],
			columns : [ [  {
				field : 'address',
				title :'小区地址',
				width : 150,
				sortable : true
			},{
				field : 'propertyName',
				title : '物业公司',
				width : 150
			},{
				field : 'remark',
				title :'备注',
				width : 150,
				sortable : true
			},{
				field : 'gmtCreate',
				title : '创建时间',
				width : 150,
				sortable : true,
				formatter:function(val,rec){ 
					 var unixTimestamp = new Date(val);  
                     return unixTimestamp.format('yyyy-MM-dd hh:mm:ss');  
				}
			}, {
				field : 'gmtModify',
				title : '最后修改时间',
				width : 150,
				sortable : true,
				formatter:function(val,rec){ 
					 var unixTimestamp = new Date(val);  
                    return unixTimestamp.format('yyyy-MM-dd hh:mm:ss');  
				}
			} ] ],
			toolbar : '#toolbar',
			onLoadSuccess : function() {
				$('#searchForm table').show();
				parent.$.messager.progress('close');
				$(this).datagrid('tooltip');
			}
		});
		
		$.ajax({
			type:'post',
			url:'/villageStatisticsController/getComboData',
			data:{},
			success:function(result) {
				$('#propertyId').combobox({
					data : result.property,
					width : 120,
				    panelHeight:'auto',
				    icons : [{
						iconCls : 'icon-clear',
						handler : function(e){
							$(e.data.target).combobox('setValue','');
						}
					}]
				});
			},
			dataType:'json'
		});
	});


	function searchFun() {
		dataGrid.datagrid('load', $.serializeObject($('#searchForm')));
	}
	function cleanFun() {
		$('#searchForm input').val('');
		dataGrid.datagrid('load', {});
	}
</script>
</head>
<body>
	<div class="easyui-layout" data-options="fit : true,border : false">
		<div data-options="region:'north',title:'查询条件',border:false" style="height: 200px; overflow: hidden;">
			<form id="searchForm">
				<table class="table table-hover table-condensed" style="display: none;">
					<tr>
						<th>小区名字</th>
						<td><input name="name" placeholder="可以模糊查询小区名字" class="span2" /></td>
					</tr>
					<tr>
						<th>小区代码</th>
						<td><input name="code" placeholder="可以模糊查询小区代码" class="span2" /></td>
					</tr>
					<tr>
						<th>小区地址</th>
						<td><input name="address" placeholder="可以模糊查询小区地址" class="span2" /></td>
					</tr>
					<tr>
						<th>物业公司</th>
						<td><input id="propertyId" name="propertyId" class="span2" /></td>
					</tr>
					<tr>
						<th>创建时间</th>
						<td><input name="startCreate" id="startCreate" placeholder="点击选择时间" class="Wdate" style="width:150px" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{$dp.$D(\'endCreate\') || \'%y-%M-%d\'}'})"/>
							至<input name="endCreate" id="endCreate" placeholder="点击选择时间" class="Wdate" style="width:150px" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'startCreate\') || \'%y-%M-%d\'}'})"/></td>
					</tr>
					<tr>
						<th>修改时间</th>
						<td><input name="startModify" id="startModify" placeholder="点击选择时间" class="Wdate" style="width:150px" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{$dp.$D(\'endModify\') || \'%y-%M-%d\'}'})"/>
							至<input name="endModify" id="endModify" placeholder="点击选择时间" class="Wdate" style="width:150px" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'startModify\') || \'%y-%M-%d\'}'})"/></td>
					</tr>
				</table>
			</form>
		</div>
		<div data-options="region:'center',border:false">
			<table id="dataGrid"></table>
		</div>
	</div>
	<div id="toolbar" style="display: none;">
		<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'brick_add',plain:true" onclick="searchFun();">过滤条件</a><a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'brick_delete',plain:true" onclick="cleanFun();">清空条件</a>
	</div>
</body>
</html>